<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./2.封装函数.js"></script>
    <style>
        .box {
            width: 100px;
            height: 100px;
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
        //事件源
        var div = $('.box')
       //事件类型   处理程序
       div.onclick = function() {
           div.style.backgroundColor = '#f00'
        //    alert('12')
        

       }
    </script>
</body>
</html>